<!doctype html>
<html>
  <head>
    <title>Web Intents</title>
    <link rel="stylesheet" href="/css/reset.css" />
    <link rel="stylesheet" href="/css/base.css" />
  </head>
  <body>
    <header>
      <h1>Web Intents</h1>
      <nav class="main">
        <span>Site: </span>
        <span><a href="http://webintents.org">Specification</a></span>
        <span><a href="http://examples.webintents.org">Examples</a></span>
        <span><a href="http://usecases.webintents.org">Usecases</a></span>
      </nav>

      <nav class="sub">
      <span>Page: </span>
      <a href="#introduction">Introduction</a>
      <a href="#javascriptshim">Javascript Shim</a>
      <a href="#api">API</a>
      <a href="#defaultintents">Default Intents</a>
      <a href="#extending">Extending</a>
      <a href="#contributing">Contributing</a>
      </nav>
    </header>  
    <section>
    <h2 id="introduction">Introduction</h2>
    <p>
    Users use many differnet services on the web to handle their day to day
    tasks, such as sharing images, editing documents and listening to music. 
    They expect their applications to be connected and to work together
    seamlessly.
    </p>
    <p>
    It is impossible for developers to anticipate every new service and to 
    intergrate with every existing external service that their users prefer 
    and thus they must choose to integrate with a few select API's at great
    expense to the developer.
    </p>
    <p>
    Web Intents solves this. Web Intents is a framework for client-side 
    service discovery and inter-application communication. Services register 
    their intention to be able to handle an action on the user's behalf.
    Applications request to start an Action of a certain verb
    (<a href="/share">share</a>, <a href="/edit">edit</a>,
     <a href="/view">view</a>, <a href="/pick">pick</a> etc) and the system 
    will find the appropriate Services for the user to use based on the user's
    preference.
    </p>
    <p>
    Web Intents puts the user in control of service integrations and makes the
    developers life simple.
    </p>
    <h2 id="api">API</h2>
    <p>
    The Web Intent API is simple to use. Service developers define the 
    intent they intend to support, and what to do with the data they recieve.
    Client applications simply initate a new action with the given parameters.
    </p>
    <h3 id="intentregistration">Intent Registration</h3>
    <pre>&lt;intent
  <a href="#action">action</a>="http://webintents.org/share" 
  <a href="#type">type</a>="image/*" 
  <a href="#href">href</a>="share.html"
 /&gt;</pre>
    <dl>
      <dt id="action">action</dt>
        <dd>Required. A verb describing the action to be performed</dd> 
      <dt id="type">type</dt>
        <dd>Optional. Types are a filter</dd> 
      <dt id="href">href</dt>
        <dd>Optional. If specified it will point to the action that is loaded 
          when the user chooses the service.  If undefined, use the current 
          page.</dd> 
    </dl>
 
    <h3 id="invocation">Invocation</h3>
    <pre>var intent = new Intent("http://webintents.org/share", 
  "text/uri-list", 
  "http://news.bbc.co.uk");

window.navigator.startActivity(intent);</pre>
    <h2 id="defaultintents">Default Intents</h2>
    <p>
      We are colating a suite of default intents that we belive the majority of
      applications and service will use.  The schema URL used to define an
      intent is designed to be self documenting.
    </p> 
    <ul>
      <li><a href="/discover">Discover</a></li>
      <li><a href="/share">Share</a></li>
      <li><a href="/edit">Edit</a></li>
      <li><a href="/view">View</a></li>
      <li><a href="/pick">Pick</a></li>
    </ul>

    <h2 id="javascriptshim">Javascript Shim</h2>
    <p>
    This is fundumentally new platform feature, and as such has not been implemented in any browser.
    To compensate and to allow you to build rich applications today, we have built an API compatible 
    JavaScript shim.
    </p>

    <p>
    It is simple to start, just drop the code in from 
    <a href="http://github.com/PaulKinlan/WebIntents">http://github.com/PaulKinlan/WebIntents</a>.
    in to your site via a &lt;script&gt; tag and your applicaiton will work across IE 8 and 9, FF 3 upwards, Chrome 5 upwards and Safari.
    </p>

    <h2 id="extending">Extending</h2>
    <p>
      Intents are matched based on their action and data type, neither of
      which are hard-coded into the system.  This makes extension and
      customization simple.  For example, an action verb could be an 
      activity-stream "post" and the data-type can be an activity-stream
      object of type "audio".
    </p>
    </section>
  </body>
</html>
